package com.garbageteam.garbageserver.service.impl;

import com.garbageteam.garbageserver.model.GarbageOut;
import com.garbageteam.garbageserver.repository.GarbageOutRepository;
import com.garbageteam.garbageserver.service.IGarbageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

@Service
public class GarbageServiceImpl implements IGarbageService {

    @Autowired
    private GarbageOutRepository garbageOutRepository;

    @Override
    public GarbageOut getGarbage(String garbageName) {
        return garbageOutRepository.findByGarbageName(garbageName);
    }

    @Override
    public Page<GarbageOut> getGarbageList(Integer garbageType, Pageable pageable) {
        return garbageOutRepository.findAllByGarbageType(garbageType,pageable);
    }
}


